//
//  ZDQNewsNBATableViewCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/30.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ZDQNewsNBATableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation ZDQNewsNBATableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
        
    }
    
    return self;
    
}



- (void)create {
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.layer.borderWidth = 1;
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    
    self.timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.timeLabel];
    self.timeLabel.layer.borderWidth = 1;
    self.timeLabel.font = [UIFont systemFontOfSize:15];
    
    self.leftImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.leftImageView];
    self.leftImageView.layer.borderWidth = 1;
    
    self.leftLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.leftLabel];
    self.leftLabel.layer.borderWidth = 1;
    self.leftLabel.font = [UIFont systemFontOfSize:13];
    self.leftLabel.textAlignment = NSTextAlignmentCenter;
    
    self.rightImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.rightImageView];
    self.rightImageView.layer.borderWidth = 1;
    
    self.rightLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.rightLabel];
    self.rightLabel.layer.borderWidth = 1;
    self.leftLabel.font = [UIFont systemFontOfSize:13];
    self.leftLabel.textAlignment = NSTextAlignmentCenter;
    
    self.scoreLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.scoreLabel];
    self.scoreLabel.layer.borderWidth = 1;
    self.scoreLabel.font = [UIFont systemFontOfSize:25];
    self.scoreLabel.textAlignment = NSTextAlignmentCenter;
    
}


- (void)layoutSubviews {
    
    [super layoutSubviews];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.contentView).with.offset(5);
        make.left.equalTo(self.contentView).with.offset(5);
        make.width.equalTo(self.contentView.mas_width).with.offset(-WIDTH / 4 - 20 * WIDTH / 375);
        make.height.equalTo(self.contentView).with.offset(-HEIGHT / 4 * 3);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).with.offset(5);
        make.right.equalTo(self.contentView).with.offset(-5);
        make.left.equalTo(self.titleLabel.mas_right).with.offset(10);
        make.height.equalTo(self.contentView).with.offset(-HEIGHT / 4 * 3);
    }];

    [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(5);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-WIDTH / 3 * 2 - 20 * WIDTH / 375);
        make.height.equalTo(self.contentView).with.offset(-HEIGHT / 3 - 20 * HEIGHT / 100);
    }];

    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.leftImageView.mas_bottom).with.offset(5);
        make.left.equalTo(self.contentView).with.offset(10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-WIDTH / 3 * 2 - 20 * WIDTH / 375);
        make.bottom.equalTo(self.contentView).with.offset(-5);
    }];

    [self.scoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(5);
        make.left.equalTo(self.leftImageView.mas_right).with.offset(10);
        make.width.equalTo(self.contentView.mas_width).with.offset(-WIDTH / 3 * 2);
        make.bottom.equalTo(self.contentView).with.offset(-5);
        
    }];
    
    
    [self.rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.titleLabel.mas_bottom).with.offset(5);
        make.left.equalTo(self.scoreLabel.mas_right).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-10);
        make.height.equalTo(self.contentView).with.offset(-HEIGHT / 3 - 20 * HEIGHT / 100);
    }];
    
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.rightImageView.mas_bottom).with.offset(5);
        make.left.equalTo(self.scoreLabel.mas_right).with.offset(10);
        make.right.equalTo(self.contentView).with.offset(-10);
        make.bottom.equalTo(self.contentView).with.offset(-5);
        
    }];
    
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
